#ifndef FTGRAPH_H
#define FTGRAPH_H

#include <QtGui>

class FTGraph : public QWidget
{
    Q_OBJECT
public:
    enum axis_flags { none, is_time };
    explicit FTGraph(QWidget *parent = 0);
    ~FTGraph();

    void paintEvent(QPaintEvent *);
    void resizeEvent(QResizeEvent *);

    void setXaxis( const QString&,
                   FTGraph::axis_flags flag = none,
                   double center = 0.0,
                   double min = 0.0,
                   double max = 0.0);
    void setYaxis( const QString&,
                   FTGraph::axis_flags flag = none,
                   double center = 0.0,
                   double min = 0.0,
                   double max = 0.0);
    void setData( const QVector<QPointF>&);
    void setTitle( const QString& );


signals:

public slots:
    void updateGraph();

private:

    QString title;

    QString x_title;
    double x_min;
    double x_max;
    double x_center;
    FTGraph::axis_flags x_flags;

    QString y_title;
    double y_min;
    double y_max;
    double y_center;
    FTGraph::axis_flags y_flags;

    QVector<QPointF> points;

    QImage* image;

    void autoXaxis();
    void autoYaxis();

};

#endif // FTGRAPH_H
